<style src="../../style/contentTable.css" scoped></style>
<template>
  <div class="containerTable">
    <!--表5蔬菜生产经营实体表T_VegProsecution-->
    <Row class="divSearch">
            <Col span="24" class="col-margin">
            <!--根据需求删除不不要查询条件-->
            填报年度：
            <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 200px" @on-change="GetData()">
                <!-- <Option value="">全部</Option> -->
                <Option :value="item.DictText" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
            </Select>
            <Button icon="ios-search" type="ghost" @click="GetData()">查询</Button>                  
            <Button icon="ios-download" type="primary" @click="ExcelDown()" style="float:right;margin-right:20px" v-show="DataModel.ReportStatus >1">数据导出</Button>
            <Upload :on-success="handleSuccess" :action="GetPostUrl()" style="float:right;margin-right:20px" v-show="DataModel.ReportStatus <3&&isTime()">
                <Button type="primary" icon="ios-cloud-upload-outline">数据导入</Button>
            </Upload>
            <Button icon="ios-download" type="primary" @click="TmpDown()" style="float:right;margin-right:20px">模板下载</Button>
            </Col>
        </Row>
        <Row>
            <Col span="24" class="col-margin" v-show="isTime()">
            <Form ref="DataModel" :model="DataModel" :rules="ruleModel" > 
                <table class="reptable">
                    <caption>
                        <label style="float:left;font-size:20px;color:#050505">{{searchModel.FillInYear}}水果技术推广机构及人员情况表（全面统计）</label>
                        <lable style="float:right" v-show="DataModel.ReportStatus==0">[<a @click="ReasonShow=true">未通过原因</a>]</lable>
                        <label style="float:right">当前状态:
                            <span v-if="DataModel.ReportStatus==0" class="Error">退回重报</span> 
                            <span v-else-if="DataModel.ReportStatus==1" class="NoReport">未填写</span>
                            <span v-else-if="DataModel.ReportStatus==2" class="AlreadyReport">已填写</span>
                            <span v-else-if="DataModel.ReportStatus==3" class="UpReport">已上报</span>
                            <span v-else-if="DataModel.ReportStatus==4" class="Success">审核通过</span>               
                            <span v-else class="NoReport">未知</span>               
                        </label>
                    </caption>
                    <thead>
                    <tr>
                        <th>名称</th>
                        <th style="width:27em">分类</th>
                        <th>数量</th>
                    </tr>
                    </thead>
                    <tr>
                        <th style="text-align:left;">一、水果技术服务机构数（个）</th>
                        <th></th>
                        <th>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum"> 
                                <Form-item prop="InstituNum">
                                    <!-- <Input v-model="DataModel.InstituNum" disabled></Input> -->
                                    <Button long>{{DataModel.InstituNum}}</Button>
                                    <td style="display:none">{{DataModel.InstituNum = DataModel.InstituNum_City*1+DataModel.InstituNum_Area*1+DataModel.InstituNum_town*1}}</td>
                                </Form-item>
                            </Poptip>
                        </th>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="3">其中</td>
                        <td style="padding-left:13em;">州市级</td>                        
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_City"> 
                                <Form-item prop="InstituNum_City">
                                    <Input v-model="DataModel.InstituNum_City" :disabled="!isCity"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">县级</td>                        
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_Area"> 
                                <Form-item prop="InstituNum_Area">
                                    <Input v-model="DataModel.InstituNum_Area" :disabled="isCity"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">乡镇级</td>                        
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldInstituNum_town"> 
                                <Form-item prop="InstituNum_town">
                                    <Input v-model="DataModel.InstituNum_town" :disabled="isCity"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align:left;" >一、专业技术人员数量（人）</th>
                        <th></th>
                        <th>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum"> 
                                <Form-item prop="PeopleNum">
                                    <!-- <Input v-model="DataModel.PeopleNum"></Input> -->
                                    <Button long>{{conPeopleNum()}}</Button>
                                </Form-item>
                            </Poptip>
                        </th>
                    </tr>
                     <tr>
                         <td style="text-align:center;" rowspan="2">其中</td>
                        <td style="padding-left:13em;">县乡级人数</td>                        
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_County"> 
                                <Form-item prop="PeopleNum_County">
                                    <Input v-model="DataModel.PeopleNum_County" :disabled="isCity"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                     <tr>
                        <td style="padding-left:13em;">州市级人数</td>                        
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_City"> 
                                <Form-item prop="PeopleNum_City">
                                    <Input v-model="DataModel.PeopleNum_City" :disabled="!isCity"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2" style="text-align:center;">（一）按性别分</td>
                        <td style="padding-left:13em;">男</td>
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_man"> 
                                <Form-item prop="PeopleNum_man">
                                    <Input v-model="DataModel.PeopleNum_man"></Input>
                                </Form-item>
                            </Poptip>
                        </td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">女</td>
                        <td>
                            <Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_woman"> 
                                <Form-item prop="PeopleNum_woman">
                                    <Input v-model="DataModel.PeopleNum_woman"></Input></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="4">（二）按年龄分</td>
                        <td style="padding-left:10em;">其中：30岁以下（含30）</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age1"> 
                                <Form-item prop="PeopleNum_age1"><Input v-model="DataModel.PeopleNum_age1"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">30-40岁（含40）</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age2"> 
                                <Form-item prop="PeopleNum_age2"><Input v-model="DataModel.PeopleNum_age2"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">40-50岁（含50）</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age3"> 
                                <Form-item prop="PeopleNum_age3"><Input v-model="DataModel.PeopleNum_age3"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">50岁以上</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_age4"> 
                                <Form-item prop="PeopleNum_age4"><Input v-model="DataModel.PeopleNum_age4"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（三）按学历层次分</td>
                        <td style="padding-left:10em;">其中：硕士及以上</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlss"> 
                                <Form-item prop="PeopleNum_xlss"><Input v-model="DataModel.PeopleNum_xlss"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">本科</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlbk"> 
                                <Form-item prop="PeopleNum_xlbk"><Input v-model="DataModel.PeopleNum_xlbk"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">大专</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xldz"> 
                                <Form-item prop="PeopleNum_xldz"><Input v-model="DataModel.PeopleNum_xldz"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">中专（技校）</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlzz"> 
                                <Form-item prop="PeopleNum_xlzz"><Input v-model="DataModel.PeopleNum_xlzz"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">其他</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_xlqt"> 
                                <Form-item prop="PeopleNum_xlqt"><Input v-model="DataModel.PeopleNum_xlqt"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="text-align:center;" rowspan="5">（四）职称情况</td>
                        <td style="padding-left:10em;">其中：正高级职称</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zczgj"> 
                                <Form-item prop="PeopleNum_zczgj"><Input v-model="DataModel.PeopleNum_zczgj"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">副高级职称</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zcfgj"> 
                                <Form-item prop="PeopleNum_zcfgj"><Input v-model="DataModel.PeopleNum_zcfgj"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">中级职称</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zczj"> 
                                <Form-item prop="PeopleNum_zczj"><Input v-model="DataModel.PeopleNum_zczj"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">初级职称</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zccj"> 
                                <Form-item prop="PeopleNum_zccj"><Input v-model="DataModel.PeopleNum_zccj"/></Form-item>
                            </Poptip></td>
                    </tr>
                    <tr>
                        <td style="padding-left:13em;">其他</td>
                        <td><Poptip trigger="focus" title="上年数据" :content="DataModel.OldPeopleNum_zcqt"> 
                                <Form-item prop="PeopleNum_zcqt"><Input v-model="DataModel.PeopleNum_zcqt"/></Form-item>
                            </Poptip></td>
                    </tr>
                </table>
                </Form>
                <div style="text-align:right;padding:10px">
                    <Button type="primary" @click="save('DataModel')" :disabled="DataModel.ReportStatus < 3 && BtnSaveStatus ? false:true">保存</Button>
                    <Button type="primary" @click="DataUp(DataModel.ReportId)" :disabled="DataModel.ReportStatus == 2 ? false:true">上报</Button>
                </div>
                <div style="padding-bottom:60px">
                    <Alert style="margin-top:5px;text-align:left" banner type="error">
                        填报时间：每年1月10日</br>
                        填报说明: 1.全省范围内从乡（镇）起，逐级全面统计，由县级填报经州（市）审核后上报。                   
                        <span slot="desc">
                        </span>
                    </Alert>
                </div>
            </Col>
            <Col class="col-margin" v-show="!isTime()">
                <Alert class="AlterWarm">不在填报时间内，无法填报！</Alert>
             </Col>
        </Row> 
         <Modal v-model="ReasonShow" :mask-closable="false" width="500"> 
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">未通过原因</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <div class="reasonDiv">{{DataModel.Opinion}}</div>
            <p slot="footer"></p>
        </Modal>         
    </div>
</template>
<script>
export default {
    data() {
         const validateData = (rule, value, callback) => {
            var temp = /^[0-9]\d*(\.\d+)?$/;
            if (value != null && value != "") {
                if (temp.test(value) == false) {
                    callback(new Error('必须是数字'));
                }
                else {
                    callback();
                }
            } else {
                callback();
            }
        };
        return {
            ReasonShow:false,//是否显示未通过原因Modal  
            isCity:false,//是否是州级人员
            ViewShow: false,//查看状态
            TableCodeList: this.GetGroupDict("ReportTableName"),//表名称
            CreateYearList: this.GetGroupDict("ReportYear"),//周期
            CycleList: this.GetGroupDict("ReportCycle"),//
            TabTitleList: [],//tab选项卡列表
            selectTabName: '',
            CurrentYear:'',//当前年度,
            BtnSaveStatus:false,
            showType: false,//编辑框弹出状态
            ruleValidate: {//验证模型
                TableName: [{ required: true, message: '报表名称不能为空', trigger: 'blur' }],
                TableCode: [{ required: true, message: '报表代码不能为空', trigger: 'blur' }],
                CreateYear: [{ required: true, message: '年度不能为空', trigger: 'blur' }],
                Cycle: [{ required: true, message: '时间周期不能为空', trigger: 'blur' }],
                CreateTime: [{ required: true, message: '生成时间不能为空', trigger: 'blur' }],
            },
            DataModel: {//编辑模型
                Id: 0,
                ReportId: '',
                Opinion:'',
                InstituNum: '',
                InstituNum_City: '',
                InstituNum_Area: '',
                InstituNum_town: '',
                PeopleNum: '',
                PeopleNum_man: '',
                PeopleNum_woman: '',
                PeopleNum_age1: '',
                PeopleNum_age2: '',
                PeopleNum_age3: '',
                PeopleNum_age4: '',
                PeopleNum_xlss: '',
                PeopleNum_xlbk: '',
                PeopleNum_xldz: '',
                PeopleNum_xlzz: '',
                PeopleNum_xlqt: '',
                PeopleNum_zczgj: '',
                PeopleNum_zcfgj: '',
                PeopleNum_zczj: '',
                PeopleNum_zccj: '',
                PeopleNum_zcqt: '',
                PeopleNum_County: '',
                PeopleNum_City: '',
                ReportStatus:'',
                OldId: 0,
                OldReportId: '',
                OldInstituNum: '',
                OldInstituNum_City: '',
                OldInstituNum_Area: '',
                OldInstituNum_town: '',
                OldPeopleNum: '',
                OldPeopleNum_man: '',
                OldPeopleNum_woman: '',
                OldPeopleNum_age1: '',
                OldPeopleNum_age2: '',
                OldPeopleNum_age3: '',
                OldPeopleNum_age4: '',
                OldPeopleNum_xlss: '',
                OldPeopleNum_xlbk: '',
                OldPeopleNum_xldz: '',
                OldPeopleNum_xlzz: '',
                OldPeopleNum_xlqt: '',
                OldPeopleNum_zczgj: '',
                OldPeopleNum_zcfgj: '',
                OldPeopleNum_zczj: '',
                OldPeopleNum_zccj: '',
                OldPeopleNum_zcqt: '',
                OldPeopleNum_County: '',
                OldPeopleNum_City: '',
                OldReportStatus:'',
            },
            ruleModel:{
                InstituNum: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_City: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_Area: [{ validator: validateData, trigger: 'blur' }],
                InstituNum_town: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_man: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_woman: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age1: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age2: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age3: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_age4: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlss: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlbk: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xldz: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlzz: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_xlqt: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zczgj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zcfgj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zczj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zccj: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_zcqt: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_County: [{ validator: validateData, trigger: 'blur' }],
                PeopleNum_City: [{ validator: validateData, trigger: 'blur' }]
            },
            //查询模型：根据需求删除不不要查询条件
            searchModel: {
                ReportCode: 'FruTecPromotion',
                FillInYear: '',
                TimesType: '',
                AreaCode: this.GetlocaStorage("fruuserinfo").AreaCode,
            }
        }
    },
    methods: {
        GetPostUrl() {
          var url = this.$http.defaults.baseURL + "Report/PostImportData?ReportCode=" + this.searchModel.ReportCode + "&&AreaCode=" + this.searchModel.AreaCode;
          return url;
        },
        GetData(){
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            self.DataModel={};//清空当前数据            
            self.$http.post("Report/PostData", model).then( //获取数据编辑项的值
                function (res) {
                    if (res.data.list.status == 2 || res.data.list.status == 1) {
                        self.DataModel = res.data.list.model;
                        self.BtnSaveStatus = true;
                    } else {
                        self.DataModel = res.data.list.model;
                        self.$Modal.warning({
                            title: "提示信息",
                            content: res.data.list.message
                        });
                        self.BtnSaveStatus = false;
                    }
                }
            );
        },
        //模板下载
        TmpDown:function(){
            window.open(this.$http.defaults.baseURL + "Report/GetTemplateData?ReportCode=" + this.searchModel.ReportCode);
        },
         //导入
        GetPostUrl() {
            var url = this.$http.defaults.baseURL + "FruTecPromotion/PostImportData?ReportCode=" + this.searchModel.ReportCode + "&&AreaCode=" + this.searchModel.AreaCode+ "&&FillInYear=" + this.searchModel.FillInYear;
            return url;
        },
        //导入成功反馈事件
        handleSuccess(res, file) {
            var self = this;
            self.GetData();
            if(res.status == -1){
                self.$Modal.warning({
                    title: "提示信息",
                    content: res.message
                });
            }else{
                self.$Notice.success({
                title: '数据导入成功！',
                desc: false
            });
            }
            
        },
         //导出
        ExcelDown: function () {
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            window.open(this.$http.defaults.baseURL + "FruTecPromotion/GetExcelData?ReportCode=" + model.ReportCode + "&&FillInYear=" + model.FillInYear + "&&AreaCode=" + model.AreaCode);
        },
        convertNum: function (num) { //小数点处理
            if (isNaN(num)||num == null||num=='') {
                return 0;
            }
            return num*1;
        },
        //上报
        DataUp(id) {
            var self = this;
            if(this.checkData){
            self.$Modal.confirm({
                title: '提示信息',
                content: '<p>是否确认上报？</p>',
                onOk: () => {
                    var model = new Object();
                    model.Id = id;
                    if(self.isCity){
                        model.reportType = '4';
                    }else{
                        model.reportType = '3';
                    }   
                    model.strMsg = '';
                    this.$http.post("Report/PostUpStatus", model).then(
                        function (res) {
                            if (res.data.status == 1) {
                                self.$Notice.success({ title: '已上报！', desc: false });
                                self.GetData();
                            }
                            else {
                                self.$Modal.error({ title: "提示信息", content: "上报失败!!!" });
                            }
                        }
                    );
                }
            });}
        },
        //查看报表
        showInfo(id, reportCode) {
            var self = this;
            this.$http.get("Report", { params: { id: id, reportCode: reportCode } }).then(//获取数据编辑项的值
                function (res) {
                    switch (res.data.list.status) {
                        case 1:
                            self.DataModel = res.data.list.model;
                            self.ViewShow = true;
                            break;
                        case 0:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                        case -1:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                    }
                }
            );
        },
        checkData(){
            var self = this;
            if((this.convertNum(self.DataModel.InstituNum_City)+this.convertNum(self.DataModel.InstituNum_Area)+ this.convertNum(self.DataModel.InstituNum_town)) != this.convertNum(self.DataModel.InstituNum)){
                self.$Modal.error({ title: "提示信息", content: "水果技术服务机构数应等于其中子项加起来的和!" });      
                return false;
            }else if((this.convertNum(self.DataModel.PeopleNum_County)+this.convertNum(self.DataModel.PeopleNum_City)) != this.convertNum(self.DataModel.PeopleNum)){
                self.$Modal.error({ title: "提示信息", content: "专业技术人员数量应等于其中子项加起来的和!" });                    
                return false;
            }else if((this.convertNum(self.DataModel.PeopleNum_man)+this.convertNum(self.DataModel.PeopleNum_woman)) != this.convertNum(self.DataModel.PeopleNum)){
                self.$Modal.error({ title: "提示信息", content: "专业技术人员数量应等于按性别分加起来的和!" });                       
                return false;
            }else if((this.convertNum(self.DataModel.PeopleNum_age1)+this.convertNum(self.DataModel.PeopleNum_age2)+this.convertNum(self.DataModel.PeopleNum_age3)+this.convertNum(self.DataModel.PeopleNum_age4))!= this.convertNum(self.DataModel.PeopleNum)){
                self.$Modal.error({ title: "提示信息", content: "专业技术人员数量应等于按年龄分加起来的和!" });                     
                return false;
            }
            else if((this.convertNum(self.DataModel.PeopleNum_xlss)+this.convertNum(self.DataModel.PeopleNum_xlbk)+this.convertNum(self.DataModel.PeopleNum_xldz)+this.convertNum(self.DataModel.PeopleNum_xlzz)+this.convertNum(self.DataModel.PeopleNum_xlqt)) != this.convertNum(self.DataModel.PeopleNum)){
                self.$Modal.error({ title: "提示信息", content: "专业技术人员数量应等于按学历层次分加起来的和!" });                      
                return false;
            }else if((this.convertNum(self.DataModel.PeopleNum_zczgj)+this.convertNum(self.DataModel.PeopleNum_zcfgj)+this.convertNum(self.DataModel.PeopleNum_zczj)+this.convertNum(self.DataModel.PeopleNum_zccj)+this.convertNum(self.DataModel.PeopleNum_zcqt)) != this.convertNum(self.DataModel.PeopleNum)){
                self.$Modal.error({ title: "提示信息", content: "专业技术人员数量应等于按职称情况分加起来的和!" });                     
                return false;
            }
            else {
                return true;
            }
        },
        conPeopleNum(){
            if((this.DataModel.PeopleNum_County !=null&&this.DataModel.PeopleNum_County!='')||(this.DataModel.PeopleNum_City !=null&&this.DataModel.PeopleNum_City!='')){
                this.DataModel.PeopleNum = this.DataModel.PeopleNum_County*1 + this.DataModel.PeopleNum_City*1;
            }
            else if((this.DataModel.PeopleNum_woman !=null&&this.DataModel.PeopleNum_woman!='')||(this.DataModel.PeopleNum_man !=null&&this.DataModel.PeopleNum_man!='')){
                this.DataModel.PeopleNum = this.DataModel.PeopleNum_woman*1 + this.DataModel.PeopleNum_man*1;
            }
            else if((this.DataModel.PeopleNum_age1 !=null&&this.DataModel.PeopleNum_age1!='')||(this.DataModel.PeopleNum_age2 !=null&&this.DataModel.PeopleNum_age2!='')||(this.DataModel.PeopleNum_age3 !=null&&this.DataModel.PeopleNum_age3!='')||(this.DataModel.PeopleNum_age4 !=null&&this.DataModel.PeopleNum_age4!='')){
                this.DataModel.PeopleNum = this.DataModel.PeopleNum_age1*1 + this.DataModel.PeopleNum_age2*1+this.DataModel.PeopleNum_age3*1 + this.DataModel.PeopleNum_age4*1;
            }
            else if((this.DataModel.PeopleNum_xlss !=null&&this.DataModel.PeopleNum_xlss!='')||(this.DataModel.PeopleNum_xlbk !=null&&this.DataModel.PeopleNum_xlbk!='')||(this.DataModel.PeopleNum_xldz !=null&&this.DataModel.PeopleNum_xldz!='')||
            (this.DataModel.PeopleNum_xlzz !=null&&this.DataModel.PeopleNum_xlzz!='')||(this.DataModel.PeopleNum_xlqt !=null&&this.DataModel.PeopleNum_xlqt!='')){
                this.DataModel.PeopleNum = this.DataModel.PeopleNum_xlss*1 + this.DataModel.PeopleNum_xlbk*1+this.DataModel.PeopleNum_xldz*1 + this.DataModel.PeopleNum_xlzz*1+this.DataModel.PeopleNum_xlqt*1;
            }
            else if((this.DataModel.PeopleNum_zczgj !=null&&this.DataModel.PeopleNum_zczgj!='')||(this.DataModel.PeopleNum_zcfgj !=null&&this.DataModel.PeopleNum_zcfgj!='')||(this.DataModel.PeopleNum_zczj !=null&&this.DataModel.PeopleNum_zczj!='')||
            (this.DataModel.PeopleNum_zccj !=null&&this.DataModel.PeopleNum_zccj!='')||(this.DataModel.PeopleNum_zcqt !=null&&this.DataModel.PeopleNum_zcqt!='')){
                this.DataModel.PeopleNum = this.DataModel.PeopleNum_zczgj*1 + this.DataModel.PeopleNum_zcfgj*1+this.DataModel.PeopleNum_zczj*1 + this.DataModel.PeopleNum_zccj*1+this.DataModel.PeopleNum_zcqt*1;
            }
            else{
                this.DataModel.PeopleNum = '';
            }
            return this.DataModel.PeopleNum;
        },
        //保存方法
        save() {
            var self = this;
            if(this.isTime()){
                this.$refs["DataModel"].validate((valid) =>{
                 if(valid){
                     //if(this.checkData()){
                       this.$http.put('FruTecPromotion', self.DataModel).then(function (res) {
                            if (res.data.status == 1) {
                                self.GetData();//读取分页数据
                                //self.modalHide();//关闭modal
                                self.$Notice.success({ title: '保存成功！', desc: false });
                            }
                            else {
                                self.$Modal.warning({ title: "提示信息", content: "更新失败,请与管理员联系!" });
                            }
                        });
                     // }
                   }
                   else{
                       self.$Modal.error({title:"提示",content:"填入的必须是数字！"})
                   }
               });
            }
            else{
                this.$Modal.warning({ title: "提示信息", content: "不在填报时间，无法填报!" });
            }
            
            
        },
        currentYear(){
                let year = new Date().getFullYear();
                let month = new Date().getMonth();                
                if(month>1){
                    this.CurrentYear = year;
                }
                else{
                    this.CurrentYear = year - 1;
                }                
            },
        isTime(){
            let month = new Date().getMonth(); 
            let year = new Date().getFullYear()+"年"; 
                if(month>2 && month<10&&(this.searchModel.FillInYear==year.toString())){
                    return false;
                }
                else{
                    return true;
                }
            }
    },
    //创建Vue页面方法
    created: function () {
        //创业Vue前调用获取this.datas: {},//table数据对象
        this.currentYear();
        this.GetData();
        let areaCode = this.GetlocaStorage("fruuserinfo").AreaCode;
        if(areaCode.substr(4, 8) == "00000000"){
            this.isCity = true;
        }else{
            this.isCity = false;
        }        
    },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>
